package ru.ksu.ktk.diploma.sdi.schema;

import java.io.IOException;
import java.io.InputStream;

import ru.ksu.ktk.diploma.sdi.schema.convertor.XML2OWLConvertor;

import com.hp.hpl.jena.ontology.OntModel;

/**
 * @author: NZhiltsov Date: 25.01.2009 Time: 21:29:51
 */
public class SchemaGeneratorImpl implements SchemaGenerator {
    /**
     * xml to owl convertor
     */
    private XML2OWLConvertor convertor;
    /**
     * namespace prefix for owl
     */
    private String prefix;
    /**
     * uri prefix for owl
     */
    private String uri;
    /**
     * project alias
     */
    private String projectAlias;
    /**
     * work directory path where owl should be created
     */
    private String workDirPath;

    /**
     * @see SchemaGenerator#generateSchema(InputStream)
     */
    public OntModel generateSchema(InputStream sourceXMLStream) throws IOException {

        OntModel ontologyModel = convertor.convert(sourceXMLStream, projectAlias);
        ontologyModel.setNsPrefix(prefix, uri);
        return ontologyModel;
    }

    public XML2OWLConvertor getConvertor() {
        return convertor;
    }

    public void setConvertor(XML2OWLConvertor convertor) {
        this.convertor = convertor;
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    public String getUri() {
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public String getWorkDirPath() {
        return workDirPath;
    }

    public void setWorkDirPath(String workDirPath) {
        this.workDirPath = workDirPath;
    }

    public String getProjectAlias() {
        return projectAlias;
    }

    public void setProjectAlias(String projectAlias) {
        this.projectAlias = projectAlias;
    }

}
